package com.geek.javase.ch07.Demo3;

import com.sun.org.apache.bcel.internal.generic.ARETURN;

import java.util.regex.Pattern;

/*
 *@author wangpeng
 *2025/10/15 18:54
 *@description TODO
 */
public class Person {
    //属性
    String name;
    String sex;
    int age;
    String qqNum;

    public boolean isValidqq(){
        return Pattern.matches("^[0-9]\\d{4,11}",this.qqNum);
    }
    public Person(String name, String sex, int age, String qqNum) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.qqNum = qqNum;
    }
    public Person(){
    }

    public String getName() {
        return name;
    }

    public String getSex() {
        return sex;
    }

    public int getAge() {
        return age;
    }

    public String getQqNum() {
        return qqNum;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setQqNum(String qqNum) {
        this.qqNum = qqNum;
    }

    public static void main(String[] args) {
        String str = new String("  anglebaby          女          18          515151511  ");
        String[] data = str.trim().split("\\s+");
        Person person = new Person(
                data[0],
                data[1],
                Integer.parseInt(data[2]),
                data[3]
        );
        System.out.println(person);
        if(person.isValidqq()){
            System.out.println("qq号合法！");
        }else{
            System.out.println("qq号不合法");
        }
    }
}
